#ifndef __BSP_CAN_H__
#define __BSP_CAN_H__

#include "bsp_cfg.h"
#include "Config.h"
#include "fifo.h"

typedef enum
{
    CAN_STB,
    CAN_RX,
    CAN_TX,
} can_ctl_pin_enum;

#define FAST_RECOVER_TIMEOUT 50  /* 快恢复时间 50ms */
#define SLOW_RECOVER_TIMEOUT 200 /* 慢恢复时间 200ms */

#define CAN_MSG_BUFFER_SIZE (48)
extern CAN_Queue_t can_send_queue;

void Bsp_CAN_GPIO_init(void);
void Module_CAN_init(uint16_t filter_id);
void BSp_CAN_init(void);
void MF_CAN_Interrupt_Init(void);
bool Bsp_get_CAN_Tx_Ready(void);
void Bsp_CAN_FIFO_Write(uint32_t id, uint8_t len, uint8_t *dat);
void CAN_busoff_handle(void);

#endif
